#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>
#include <linux/un.h>
#include "ipc_socket.h"


int main()
{
    int fd = -1;
    int ret = -1;
    int num = 0;
    int status = 0;
    char buff[1024] = {0};
    pthread_t thread_id;
    fd = client_socket_init();
    if(fd == -1) {
        exit(0);
    }
    
    ret = socket_recv_thread(&thread_id, fd);
    if(ret == -1) {
        perror("Thread");
        close(fd);
    }
    while(is_exit())
    {   
        sprintf(buff, "Hello ===>%d", num++);
        socket_send_msg(fd, buff, sizeof(buff));
        sleep(1);   // 每隔1s发送一条数据
    }
    pthread_join(thread_id, (void *)&status);
    close(fd);
    return 0;
}
